package com.lightboat.system.service;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lightboat.common.core.domain.bo.LogisticsOrderBo;
import com.lightboat.system.domain.CrmOrder;
import com.lightboat.system.domain.request.*;

import java.util.List;

/**
 * 订单Service接口
 * 
 * @author lightboat
 * @date 2025-08-14
 */
public interface ICrmOrderService  extends IService<CrmOrder> {

    /**
     * 查询订单
     * 
     * @param orderId 订单主键
     * @return 订单
     */
    public CrmOrder selectCrmOrderByOrderId(Long orderId);

    /**
     * 查询订单列表
     * 
     * @param crmOrder 订单
     * @return 订单集合
     */
    public List<CrmOrder> selectCrmOrderList(CrmOrder crmOrder);

    List<CrmOrder> selectCrmOrderList(CrmOrder crmOrder, Wrapper<?> queryWrapper);

    /**
     * 新增订单
     * 
     * @param crmOrder 订单
     * @return 结果
     */
    public int insertCrmOrder(CrmOrder crmOrder);

    /**
     * 修改订单
     * 
     * @param crmOrder 订单
     * @return 结果
     */
    public int updateCrmOrder(CrmOrder crmOrder);

    /**
     * 批量删除订单
     * 
     * @param orderIds 需要删除的订单主键集合
     * @return 结果
     */
    public int deleteCrmOrderByOrderIds(Long[] orderIds);

    /**
     * 删除订单信息
     * 
     * @param orderId 订单主键
     * @return 结果
     */
    public int deleteCrmOrderByOrderId(Long orderId);

    /**
     * 监听订单
     * @param data  数据
     * @param extra 额外信息
     * @param status 状态
     * @return
     */
    int listeningOrder(JSONObject data, JSONObject extra, int status);

    /**
     * 分配业务员
     * @param request
     * @return
     */
    String assignSalesman(AssignSalesmanRequest request);

    /**
     * 订单发货
     * @param request
     * @return
     */
    LogisticsOrderBo logisticsShipping(LogisticsShippingRequest request);

    /**
     * 订单取消
     * @param request
     * @return
     */
    LogisticsOrderBo logisticsCancel(LogisticsCancelRequest request);

    /**
     * 新增复购订单
     * @param request
     * @return
     */
    int addRepurchase(AddRepurchaseOrderRequest request);

    /**
     * 新增多包裹复购订单
     * @param request
     * @return
     */
    int addRepurchases(AddsRepurchaseOrderRequest request);

    /**
     * 订单置顶
     * @param request
     * @return
     */
    int orderTop(OrderTopRequest request);

    /**
     * 新增复购补货订单
     * @param request
     * @return
     */
    int addReplenishment(AddReplenishmentOrderRequest request);

    /**
     * 追加复购订单
     * @param request
     * @return
     */
    int appendRepurchase(AppendRepurchaseOrderRequest request);

    /**
     * 合并订单数据
     * @param list
     * @param request
     */
    void combineOrderData(List<CrmOrder> list, CrmOrder request);

    /**
     * 查询公海订单
     * @param crmOrder
     * @return
     */
    List<CrmOrder> selectHighSeasOrderList(CrmOrder crmOrder);

    /**
     * 核销订单
     * @param request
     * @return
     */
    int verification(VerificationOrderRequest request);

    /**
     * 订单完成
     * @param request
     * @return
     */
    int completeOrder(CompleteOrderRequest request);
}
